﻿Name: 		NeXAS
Description: 	戯画(GIGA) NeXAS system(conclude that BaldrX system's next version)
Archive: 	.pac
Author: 	痴漢公賊 (glanser@163.com)
Version: 	1.0.0
Status: 	Alpha

【NOTICE】
·Some bmp resource files extracted from Stand.pac of BFR that attached with Xcross Scramble have problems, which may due to the resource files themselves, not cui. 

【.pac Archive Info】
    the pac is actual type of archive with directory.
    original data according to practical situation, can be bmp, png, grp, ogg, wav, bin(compiled binary script), src(script source code*1), exe(script compiler, filter maker etc. assistant tool*1) or ani and so on.
    the archive is used in games made by GIGA company and sub-company.

    	header: 
    		s8 magic[4];	// "PAC" or "PACw"("PACw" seems only exist in se.pac, and judgement only depend on "PAC" 3 bytes)
		u32 entries;	// every item with 76 bytes
		u32 cmode;	// 0 or 4: no compression; 1: lzss compression; 2: huffman compression; 3: zlib compression
	last 4 bytes of file ending: 
		length of compressed index segment - index_length. from the field forward index_length in length is index segment using normal huffman coding
	index segment(after normal huffman decoding):						
		s8 name[64];	// resource name
		u32 offset;	// resource data offset(count from header)
		u32 uncomprLen;	// decompressed data legnth(if in no compression, value of the field equal to comprLen's one)
		u32 comprLen;	// compressed data legnth
	data: 
		closely behind header.

    *1: doubt that developer carelessly leak out

【.grp Resource Info】
    original data is bmp.
   	
   	header:  
		s8 magic[3];	// "GR3"(3-bit copy_bytes; 13-bit win_offset)
		u16 bits_count;	// color depth
		u32 width;	// width
		u32 height;	// height
		u32 dib_len;	// compressed data legnth
		u32 flag_bits;	// number of bits of lzss flag-bit
	flag segment: 
		all lzss flag-bit gathered to the segment, actual length of the segment equal to (flag_bits+7)/8.
	data: 
		closely behind flag segment.

【ChangeLog】
2009-05-30 20:20 ver 1.0.0 support mode2 compression method for resource
2009-03-28 00:02 ver 0.9.6 supported extracting bmp compressed with zlib
2009-01-10 11:37 ver 0.9.5 supported extracting internal resource using zlib compression
2007-12-23 16:09 ver 0.9.4 fixed a problem on saving failure 
2007-04-03 21:55 ver 0.9.3 revised a little for empty archive Update.pac in Xross Scramble
2007-04-03 21:56 ver 0.9.2 did distinction of type GR2 and GR3 grp file
2007-03-26 14:50 ver 0.9.1 fixed a bug for decompressing short file; renamed plug-in to NeXAS
2007-03-22 21:26 ver 0.9.0 re-programmed to coordinate crage with modification of structure; supported exporting grp
2007-02-17 00:46 ver 0.0.1 1st version released, didn't support extracting type mode2 archive